package com.ibm.ops.domain.report;

import com.ibm.ops.OpstoolConstant;
import com.ibm.ops.domain.OpsLogMetaDataType;
import com.ibm.ops.domain.metadata.OpsAuditLogFODSDoNotProcessReportMetaData;
import com.ibm.ops.domain.metadata.OpsAuditLogReportMetaData;

public class OpsAuditLogFODSDoNotProcessReport extends OpsAuditLogReport {

	@Override
	protected OpsAuditLogReportMetaData constructOpsAuditLogReportMetaData(String metaData) {
		OpsAuditLogFODSDoNotProcessReportMetaData fodsdonotProcessMetaData = new OpsAuditLogFODSDoNotProcessReportMetaData();
		fodsdonotProcessMetaData.setType(OpsLogMetaDataType.FODS);
		fodsdonotProcessMetaData.setSap_docnum(this.retrieveData(metaData,OpstoolConstant.FODS_DONOT_PROCESS_REPORT_SAP_DOC_NUM_START_IX,OpstoolConstant.FODS_DONOT_PROCESS_REPORT_SAP_DOC_NUM_START_IX + OpstoolConstant.FODS_DONOT_PROCESS_REPORT_SAP_DOC_NUM_LENGTH));
		fodsdonotProcessMetaData.setStatus(this.retrieveData(metaData,OpstoolConstant.FODS_DONOT_PROCESS_REPORT_STATUS_START_IX,OpstoolConstant.FODS_DONOT_PROCESS_REPORT_STATUS_START_IX + OpstoolConstant.FODS_DONOT_PROCESS_REPORT_STATUS_LENGTH));
		fodsdonotProcessMetaData.setIdoc_number(this.retrieveData(metaData,OpstoolConstant.FODS_DONOT_PROCESS_REPORT_IDOC_NUMBER_START_IX,OpstoolConstant.FODS_DONOT_PROCESS_REPORT_IDOC_NUMBER_START_IX + OpstoolConstant.FODS_DONOT_PROCESS_REPORT_IDOC_NUMBER_LENGTH));
		fodsdonotProcessMetaData.setGeo_key(this.retrieveData(metaData,OpstoolConstant.FODS_DONOT_PROCESS_REPORT_GEO_KEY_START_IX,OpstoolConstant.FODS_DONOT_PROCESS_REPORT_GEO_KEY_START_IX + OpstoolConstant.FODS_DONOT_PROCESS_REPORT_GEO_KEY_LENGTH));
		fodsdonotProcessMetaData.setMestype(this.retrieveData(metaData,OpstoolConstant.FODS_DONOT_PROCESS_REPORT_MESTYPE_START_IX,OpstoolConstant.FODS_DONOT_PROCESS_REPORT_MESTYPE_START_IX + OpstoolConstant.FODS_DONOT_PROCESS_REPORT_MESTYPE_LENGTH));
		fodsdonotProcessMetaData.setSerial_number(this.retrieveData(metaData, OpstoolConstant.FODS_DONOT_PROCESS_REPORT_SERIAL_NUMBER_START_IX, OpstoolConstant.FODS_DONOT_PROCESS_REPORT_SERIAL_NUMBER_START_IX + OpstoolConstant.FODS_DONOT_PROCESS_REPORT_SERIAL_NUMBER_LENGTH));
		fodsdonotProcessMetaData.setSndprn(this.retrieveData(metaData, OpstoolConstant.FODS_DONOT_PROCESS_REPORT_SNDPRN_START_IX, OpstoolConstant.FODS_DONOT_PROCESS_REPORT_SNDPRN_START_IX + OpstoolConstant.FODS_DONOT_PROCESS_REPORT_SNDPRN_LENGTH));
		this.currentMetaData = fodsdonotProcessMetaData;
		return fodsdonotProcessMetaData;
	}

	@Override
	protected OpsAuditLogReportMetaDataKey retrieveOpsAuditLogReportMetaDataKey(String metaData) {
		String key = null;
		if(this.currentMetaData != null){
			if(this.currentMetaData instanceof OpsAuditLogFODSDoNotProcessReportMetaData){
				OpsAuditLogFODSDoNotProcessReportMetaData obj = ((OpsAuditLogFODSDoNotProcessReportMetaData) this.currentMetaData);
				key = obj.getSap_docnum() + obj.getIdoc_number() + obj.getSerial_number();
			}			
		}else{
			key = this.retrieveData(metaData,OpstoolConstant.FODS_DONOT_PROCESS_REPORT_SAP_DOC_NUM_START_IX,OpstoolConstant.FODS_DONOT_PROCESS_REPORT_SAP_DOC_NUM_START_IX + OpstoolConstant.FODS_DONOT_PROCESS_REPORT_SAP_DOC_NUM_LENGTH)
					+ this.retrieveData(metaData,OpstoolConstant.FODS_DONOT_PROCESS_REPORT_IDOC_NUMBER_START_IX,OpstoolConstant.FODS_DONOT_PROCESS_REPORT_IDOC_NUMBER_START_IX + OpstoolConstant.FODS_DONOT_PROCESS_REPORT_IDOC_NUMBER_LENGTH)
					+ this.retrieveData(metaData, OpstoolConstant.FODS_DONOT_PROCESS_REPORT_SERIAL_NUMBER_START_IX, OpstoolConstant.FODS_DONOT_PROCESS_REPORT_SERIAL_NUMBER_START_IX + OpstoolConstant.FODS_DONOT_PROCESS_REPORT_SERIAL_NUMBER_LENGTH);
		}
		return new OpsAuditLogReportMetaDataKey(key);
	}

}
